package controllers

import (
	"passport/login"
)

type AuthorizeController struct {
	URLSignController
}

//获取微信网页登录授权
// h5Type, 1:指尖到家微信h5  2:轻客微信h5
// @router /h5/openid/get [get]
func (p *AuthorizeController) GetOpenidByCode() {
	defer p.Output("GetOpenidByCode")

	auCode := p.GetString("code", "")
	h5Type := 1
	if p.AppKey == "e3b01549970b4a65a3b29f8e2c12939b" {
		h5Type = 2
	}
	code, msg, data := login.GetAuthorizeService().GetOpenidByCode(auCode, h5Type)
	p.Resp["code"] = code
	p.Resp["msg"] = msg
	if code == 0 {
		//获取到用户基本信息
		p.Resp["userinfo"] = data
	}
}
